package com.xiaoye.qbdatahandle.converter;

import cn.hutool.Hutool;
import cn.hutool.core.date.DateUtil;
import org.springframework.core.convert.converter.Converter;
import org.springframework.data.convert.WritingConverter;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.TimeZone;

//@WritingConverter
public class DateToStringConverter implements Converter<Date, String> {
    @Override
    public String convert(Date date) {
        if (date == null) {
            return null;
        }
        return DateUtil.format(date, "yyyy-MM-dd HH:mm:ss");
    }
}